package com.fdd.op.sdk;

import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.mapping.ApiField;

import java.io.Serializable;
import java.util.Map;

/**
 * 基础响应信息
 *
 * @author Fadada
 * @date 2021/04/26
 */
public abstract class FddResponse implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiField(Constants.ERROR_CODE)
    private String code;

    @ApiField(Constants.ERROR_MSG)
    private String message;

    @ApiField("path")
    private String path;

    @ApiField("timestamp")
    private String timestamp;

    /**
     * API响应JSON或XML串
     */
    private String body;

    /**
     * API请求参数列表
     */
    private Map<String, Object> params;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public Map<String, Object> getParams() {
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }

    public boolean isSuccess() {
        return Constants.STRING_0_FLAG.equals(this.code);
    }
}
